/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.actions;

/**
 * PlayerTypeActions are used to assign heterogeneous player-types to the 
 * players before simulation starts, or to exchange players during game. 
 * The action can only be performed by the coach or the trainer, and the 
 * assignment is further restricted:
 * <ul>
 *   <li>Each heterogeneous player-type can only be assigned three times.
 *   <li>Goalies can't be assigned to heterogeneous player types. These always
 *       are of the default type (0).
 *   <li>Exchanging during game can only be performed three times. Therefore,
 *       one of the remaining possible assignments have to be used. This will
 *       refresh all stamina-related attributes of the agent.
 * </ul>
 * 
 * Note that for a usage with the trainer, this command should be extended to 
 * have a team as well.
 */
public class PlayerTypeAction extends Action {

	/**
	 * The tricot number of the player, which should be assigned to a 
	 * heterogeneous player-type.
	 */
	private int player = -1;

	/**
	 * The id of the heterogeneous player type. These are given in the player
	 * configurations send by the server.
	 */
	private int type = -1;

	/**
	 * This class provides an action, which will change a player-type of a
	 * player to one of the types sent by the server!
	 */
	public PlayerTypeAction(int player, int type) {
		super();
		this.player = player;
		this.type = type;
	}

	/**
	 * Returns the actions string representation:
	 * @return 
	 * (change_player_type &lt;player&gt; &lt;type&gt;)<br><br>
	 */
	@Override
	public String toString() {
		StringBuffer buff = new StringBuffer();
		buff.append("(change_player_type ");
		buff.append(this.player);
		buff.append(' ');
		buff.append(this.type);
		buff.append(')');
		return buff.toString();
	}

}
